package animalmanage;
import java.util.Random;
public class Animal implements AnimalBehavior{
    //动物名
    private String AnimalName;
    //动物数量
    private int AnimalNum;

    private int RandomInt;


    //动物所在区域
    private String AnimalArea;
    //相对应的getter和setter方法
    public String getAnimalName() {
        return AnimalName;
    }

    public void setAnimalName(String animalName) {
        AnimalName = animalName;
    }

    public int getAnimalNum() {
        return AnimalNum;
    }

    public void setAnimalNum(int animalNum) {
        AnimalNum = animalNum;
    }

    public String getAnimalArea() {
        return AnimalArea;
    }

    public void setAnimalArea(String animalArea) {
        AnimalArea = animalArea;
    }

    public int getRandomInt() {
        Random Rand=new Random();
        return Rand.nextInt(4)+1;

    }


    //动物行为
    public void eat() {
        System.out.println(getAnimalName()+"在吃东西");
    }
    public void play() {
        System.out.println(getAnimalName()+"在玩耍");
    }

    @Override
    public void drink() {
        System.out.println(getAnimalName()+"在喝水");
    }

    @Override
    public void climTree() {
        System.out.println(getAnimalName()+"在爬树");
    }

    public  void AnimalRodomBehavior(){
        switch (getRandomInt()){
            case 1: drink();
                break;
            case 2: eat();
                break;
            case 3: climTree();
                break;
            case 4: play();
                break;
        }

    }

    public void location(){
        System.out.println(getAnimalName()+"所在园区为"+getAnimalArea());
    }
    public void Behavior(){
        AnimalRodomBehavior();
    }
}